<template>
    <div>
         <we-header @showExtend="showExtend">发现</we-header>
        <!-- 顶部弹出框 -->
        <we-popup ref="upPopup" up>
           <down-list></down-list>
        </we-popup>
        <div class="found-wrapper">
            <div v-for="(item,index) in discoverList" :key="index">
  <cell-list :itemList="item" @sendEvent='sendEvent'></cell-list>
    </div>
        </div>
    </div>
</template>
<script>
import weHeader from './common/weHeader';
import wePopup from './common/wePopup';
import downList from './common/downList';
import cellList from './common/cellList';
import {Meteor} from 'meteor/meteor';
import { image, user,circleStatus } from '../../api/collections/index';
export default {
    components:{
        weHeader,
        wePopup,
        downList,
        cellList
    },
        meteor: {
    $subscribe: {
      'userInf': []
    },
    circleStstus(){
      let arr = circleStatus.find({fid:sessionStorage.getItem('user'),isRead:false}).fetch()
        if(arr.length!==0){
          arr.sort((item1,item2)=>{return item2.create_time-item1.create_time})
          id = arr[0].uid
          const getUser = user.findOne({_id:id})
        if(getUser){
             const avatar = image.findOne({_id:getUser.avatarId})
            avatar&&( this.discoverList[0].avatar = avatar.base64)
            this.discoverList[0].showTip = true
        }
        }
        else{
          this.discoverList[0].avatar = ''
          this.discoverList[0].showTip = false
        }
    }
    },
    methods:{
        showExtend(){
        this.$refs.upPopup.show()
    },
    sendEvent(e){
      switch(e){
        case 'pyq':this.$router.push('/friendCircle');break;
        default:this.$notify({ type: 'success', message: '功能暂未开发',duration: 500 });break;
      }
    }
    },
    data(){
        return{
         // 发现页cellList
        discoverList:[
          {
          separate:true,
          describe:'朋友圈',
          icon:'#icon-pengyouquan',
          content:'',
          color:'',
          iconTip:true,
          showTip:false,
          avatar:'',
          event:'pyq'
        },
         {
          separate:true,
          describe:'视频号',
          icon:'#icon-shipinhao',
          content:'',
          color:''
        },
         {
          separate:true,
          describe:'扫一扫',
          icon:'#icon-saoyisao',
          content:'',
          color:''
        },
         {
          separate:true,
          describe:'看一看',
          icon:'#icon-kanyikan',
          content:'',
          color:''
        },
         {
          separate:false,
         moreList:[
           {
              describe:'购物',
              icon:'#icon-gouwu',
              content:'',
              color:'#D88E9B'
           },
           {
              describe:'游戏',
              icon:'#icon-weixinyouxi-02-02',
              content:''
           }
         ]
        },
         {
          separate:true,
          describe:'小程序',
          icon:'#icon-xiaochengxu',
          content:'',
          color:'#6864B1'
        }
        ]
        }
    }
}
</script>
<style scoped>
.found-wrapper{
    margin-top: 1.7rem;
    background-color: #EDEDED;
}
</style>